Core java - Interview Questions and Answers for 'Trustwave' - 3 question(s) found - Order By Newest Q1. How are values passed in Java ? By value or reference ? Core Java
Ans. Java only provides pass by value. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  ebay   pass by value   pass by reference   method call   methods   functions   function call Asked in 10 Companies basic   frequent Related Questions What are the common uses of "this" keyword in java ? What are strong, soft, weak and phantom references in Java ? When we say final x = 10, is the reference final or the value ? Difference between a Pointer and a Reference ? If a method definition has been specified in Class , its Base Class , and the interface which the class is implementing, Which definition will be picked if we try to access it using Interface Reference and Class object ? If a method definition has been specified in the Base Class and the interface which the class is implementing, Which definition will be picked if we try to access it using Interface Reference and Class object ? Can we access Interface static method using Interface references ? Why is null == null returns true ? Can we have foreign key reference to a non primary key column ? Q2. Write a multi threaded Program that will simulate transferring of money across accounts ? Core Java
This question was recently asked at 'Trustwave'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Related Questions Which keyword is used to provide explicit access of a code block to single thread ?
a. Transient
b. Final
c. Explicit
d. Synchronized How does volatile affect code optimization by compiler? Will this code give error if i try to add two heterogeneous elements in the arraylist. ? and Why ? What is the difference between the following two code lines ?
1. new OuterClass().new InnerClass();
2. new OuterClass.InnerClass(); Which String class does not override the equals() and hashCode() methods, inheriting them directly from class Object? If arrays cannot be resized , Why is this code valid
String[] strArray = new String[2];
strArray = new String[5]; Will the static block be executed in the following code ? Why ? If you are given a choice to implement the code to either Insert a Record or Update if already exist, Which approach will you follow ? Which of the following is not the advantage of Mocking frameworks ? How can we make sure that a code segment gets executed even in case of uncatched exceptions ? Q3. Write a Program to convert a binary to number ? Core Java
Ans. int convert(int binaryInt) {
int sumValue=0;
int multiple = 1;
while(binaryInt > 0) {
binaryDigit = binaryInt;
binaryInt = binaryInt /10;
sumValue = sumValue (binaryDigit * multiple);
multiple = multiple * 2;
}
return sumValue;
} Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  code  coding Asked in 1 Companies basic Related Questions Which keyword is used to provide explicit access of a code block to single thread ?
a. Transient
b. Final
c. Explicit
d. Synchronized How does volatile affect code optimization by compiler? Will this code give error if i try to add two heterogeneous elements in the arraylist. ? and Why ? What is the difference between the following two code lines ?
1. new OuterClass().new InnerClass();
2. new OuterClass.InnerClass(); Which String class does not override the equals() and hashCode() methods, inheriting them directly from class Object? If arrays cannot be resized , Why is this code valid
String[] strArray = new String[2];
strArray = new String[5]; Will the static block be executed in the following code ? Why ? If you are given a choice to implement the code to either Insert a Record or Update if already exist, Which approach will you follow ? Which of the following is not the advantage of Mocking frameworks ? How can we make sure that a code segment gets executed even in case of uncatched exceptions ?